<%-- 
    Document   : displayTeams_Instr
    Created on : Jun 29, 2011, 7:36:34 PM
    Author     : Tyler Powell
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <link rel="stylesheet" type="text/css" href="style.css">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Your Teams - Lab Assistant Pro</title>
    </head>
    <body>
        <%@include file="pro_header.jsp" %>
        <%@include file="instr_list.jsp" %>
        <div id="main">
            <h1>Labs and Teams</h1>
            <p>Below is a list of the labs and teams in the courses you teach.</p>
            <br>
            
            <% //Show the instructor his courses, labs, teams, and students
            Object tempPageVar = session.getAttribute("persistUser");
            if(((Instructor)tempPageVar).getCourseList().size() > 0)
            {
                for(Course aCourse : ((Instructor)tempPageVar).getCourseList())
                {
                    out.println("<strong>" + aCourse.getName() + ":</strong><br><ul>");
                    if(aCourse.getLabList().size() > 0)
                    {
                        for(Lab aLab : aCourse.getLabList())
                        {
                            String labInfo = "<i>" + aLab.getName() + 
                                    " Start Date: " + aLab.getStartDate() +
                                    " Start Time: " + aLab.getStartTime() +
                                    " End Date: " + aLab.getEndDate() +
                                    " End Time: " + aLab.getEndTime()
                                    + ":</i><br><ul>";
                            out.println(labInfo);
                            if(aLab.getTeamList().size() > 0)
                            {
                                for(Team aTeam : aLab.getTeamList())
                                {
                                    out.println(aTeam.getName() + ":<br><ul>");
                                    if(aTeam.getStudentList().size() > 0)
                                    {    
                                        for(Student stud : aTeam.getStudentList())
                                        {
                                            out.println(stud.getName() + "<br>");
                                        }
                                    }
                                    else
                                    {
                                        out.println("This team has no members.<br>");
                                    }
                                    out.println("</ul>");
                                }
                            }
                            else if(aLab.getTeamDesignation() == Lab.NOTEAM)
                            {
                                out.println("This lab does not allow teams, students:<br><ul>");
                                if(aLab.getTeamlessStudents().size() > 0)
                                {
                                    for(Student stud : aLab.getTeamlessStudents())
                                    {
                                        out.println(stud.getName() + "<br>");
                                    }
                                }
                                else
                                {
                                    out.println("There are no students in this lab.<br>");
                                }
                                out.println("</ul>");
                            }
                            else
                            {
                                out.println("No teams have been created for this lab.<br>");
                            }
                            out.println("</ul>");
                        }
                    }
                    else
                    {
                        out.println("You have not created any labs.<br>");
                    }
                    out.println("</ul>");
                }
            }
            else
            {
                out.println("You have not created any courses.<br>");
            }
            
            %>
        </div>
        <% } //ends user_redirect else statement, html is included here %>
        <% } //ends verifySession.jsp, all html is included in else statment %>
    </body>
</html>
